program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement = ^element;
  element = record
    value: integer;
    next: pelement;
  end;

procedure ATB (var head: pelement; num: integer);
var
  tmp: pelement;
begin
  tmp:= head;
  new (head);
  head^.next:=tmp;
  head^.value:=num;
end;

procedure PL (head: pelement);
var
  current: pelement;
begin
  current:=head;
  while (current <> nil) do
  begin
    writeln(current^.value);
    current:=current^.next;
  end;
end;

procedure ATE (var head: pelement; num: integer);
var
  current: pelement;
begin
  if (head <> nil) then
  begin
    current:=head;
    while (current^.next <> nil) do
    begin
      current:=current^.next;
    end;
    new (current^.next);
    current^.next^.value:=num;
    current^.next^.next:=nil;
  end else begin
  ATB (head, num);
  end;
end;

procedure CP (var head: pelement);
var
  current, current1, current2, heada, headba: pelement;
  xa, a, i, n, l: integer;
begin
  heada:= nil;
  headba:= nil;
  current:=head;
  n:=0;
  while current <> nil do
  begin
    n:=n+1;
    current:= current^.next;
  end;
  current:= head;
  if n mod 2 = 0 then
  begin
    l:= n div 2;
    for i:= 1 to l do
    begin
      a:=current^.value;
      ATE (heada, a);
      current:=current^.next;
    end;
    for i:= 1 to l do
    begin
      a:=current^.value;
      ATE (headba, a);
      current:=current^.next;
    end;
    current1:=headba;
    while current1^.next <> nil do
    begin
      current1:=current1^.next;
    end;
    current2:=heada;
    for i:= 1 to l do
    begin
      a:=current2^.value;
      ATE (current1^.next, a);
      current1:=current1^.next;
      current2:=current2^.next;
    end;
  end else begin
    l:= (n-1) div 2;
    for i:= 1 to l do
    begin
      a:=current^.value;
      ATE (heada, a);
      current:=current^.next;
    end;
    xa:=current^.value;
    current:=current^.next;
    for i:= 1 to l do
    begin
      a:=current^.value;
      ATE (headba, a);
      current:=current^.next;
    end;
    current1:=headba;
    while current1^.next <> nil do
    begin
      current1:=current1^.next;
    end;
    ATE (current1^.next, xa);
    current1:=current1^.next;
    current2:=heada;
    for i:= 1 to l do
    begin
      a:=current2^.value;
      ATE (current1^.next, a);
    current1:=current1^.next;
    current2:=current2^.next;
    end;
  end;
  PL (headba);
end;

var
  head: pelement;
  n, a, i: integer;
  fin: TextFile;


begin
  assignFile (fin, 'input.txt');
  reset (fin);

  head:=nil;
  read (fin, n);
  for i:= 1 to n do
  begin
    read (fin, a);
    ATE (head, a);
  end;
  CP (head);
  readln;

  closeFile (fin);
end.













